﻿using SqlBuilder;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Main
{
    /// <summary>
    /// TablesUC.xaml 的交互逻辑
    /// </summary>
    public partial class TablesUC : UserControl
    {
        public TablesUC()
        {
            InitializeComponent();
        }

        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            var tables = await Functions.GetTableStructure();
            var columns = new List<Column> {
                new Column { Comment="科室ID"},
                new Column { Comment="科室名称"},
                new Column { Comment="科室全称"}
            };
            var t = Functions.Find(tables,columns);
        }
        public TableStructure SelectedTable { get; private set; }
        private void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            this.SelectedTable = this.dataGrid.SelectedItem as TableStructure;
            if (SelectTableChanged != null)
                SelectTableChanged(this, e);
        }
        public event EventHandler<EventArgs> SelectTableChanged;
    }
}
